import QtQuick 2.6
import QtQuick.Window 2.2
import Toou2D 1.0

Window {
    id:rootwindow
    visible: true
    visibility:Window.FullScreen

    //flags: Qt.WindowStaysOnBottomHint
//    width: 1024
//    height: 700




    /***
      * T2DWorld是T2D框架中最重要的配置
      ***/

    T2DWorld{
        mouseAreaCursorShape: Qt.PointingHandCursor
        appStartupTheme: "Solarized"
        appThemePaths: [
            "qrc:/themes/"
        ]
    }





    TRectangle{
        width: parent.width;
        height: parent.height;
        color: "#FFF"
        x:menu.isopen ? 90 : 0;


        Topbar{
            id:topbar;
            width: parent.width;
            height: 45;
            onShowMenu: menu.open();
        }

        Loader{
            id:pageloader;

            anchors{
                left:  parent.left;
                right: parent.right;
                top:   topbar.bottom;
                bottom: footerbar.top;
            }
            source: "qrc:/Home.qml"


            function begin(){
                menu.open();
            }

            function toPage(uri,title){
                source = uri;
                topbar.title = title;
            }

        }

        Menubar{
            id:menu

            width: 160;
            height: rootwindow.height;
            onTopage: function(uri,title) {
                if (title === '退出')  {
                    Qt.quit()
                }
                pageloader.toPage(uri,title);
            }
        }

        Footerbar{
            id:footerbar
            width: parent.width;
            height: 20;
            anchors.bottom: parent.bottom;
        }

        Behavior on x {
            NumberAnimation {
                duration: 100
            }
        }
    }

    Component.onCompleted: {
        TToast.layoutY = 20;
    }


}
